package com.xing.service.impl;

import com.xing.dao.BookDao;
import com.xing.pojo.Book;
import com.xing.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookDao bookDao;

    @Override
    public boolean save(Book book) {
        int save = bookDao.save(book);
        return save > 0;
    }

    @Override
    public boolean update(Book book) {
        int update = bookDao.update(book);
        return update > 0;
    }

    @Override
    public boolean delete(Integer id) {
        int delete = bookDao.delete(id);
        return delete > 0;
    }

    @Override
    public Book getBookById(Integer id) {
        Book bookById = bookDao.getBookById(id);
        return bookById;
    }

    @Override
    public List<Book> getBookList() {
        List<Book> bookList = bookDao.getBookList();
        return bookList;
    }
}
